/**
 * 获取图片资源
 * @param fileId 
 * @returns 
 */
export const sysFileDownloadApi = async (fileId: string) => {
  return new Promise((resolve) => {
    if(!fileId) {
      resolve("");
      return;
    }

    const obj = {
      "1": "16pic/00/67/66/16pic_6766250_b.jpg",
      "2": "baiduImage/it/u=3879890807,997649473&fm=253&app=138&f=JPEG?w=889&h=500",
      "3": "baiduImage/it/u=3093093651,73514974&fm=253&app=138&f=JPEG?w=1422&h=800",
    }

    // @ts-ignore
    const url = obj?.[fileId] || "";
    
    try {
      fetch(url).then(async (result) => {
        const blob = await result.blob();
        const reader = new FileReader();
        reader.onload = () => {
          resolve(reader?.result || "");
        };
        reader.readAsDataURL(blob);
      });
    } catch (error) {
      resolve("");
    }
  })
};
